package org.enhance.async.init.controller;

import org.enhance.async.init.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * hello controller
 *
 * @author wenpan 2023/06/11 22:30
 */
@RestController("HelloController")
@RequestMapping("/hello")
public class HelloController {

    @Autowired
    private HelloService helloService;

    /**
     * 可以看到在init方法未执行完成之前，该接口是不会被暴露出去的
     */
    @GetMapping("/say")
    public String sayHello(@RequestParam String name) {
        return helloService.sayHello(name);
    }
}
